package tsVRPTW;

import static tsVRPTW.InitAndPrint.*;  
import static tsVRPTW.TS.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import static tsVRPTW.Parameter.*;

public class Main {

	public static void main(String[] args) {
		long beginTime = System.nanoTime();
		ReadIn();
		Construction();
		TabuSearch();
		Output();
		Check_Ans();
		long endTime = System.nanoTime();
		double usedTime = (endTime-beginTime)/(1e9);
		System.out.println();
		System.out.println("The total time is :"+usedTime+"s");
		
//		将实验中的解的评价函数值，写入solutions.txt文件中
		try {
			File file = new File("solutions.txt");
			if (!file.exists()) {
				file.createNewFile();
			}
			FileWriter fileWriter = new FileWriter(file.getName(), true);
			for (int i = 0; i < solution.size(); i++) {
				fileWriter.write(String.valueOf(solution.get(i))+"\r\n");
			}
			fileWriter.close();
			System.out.println("输入完毕！");
		} catch (IOException e) {
			System.out.println("错误！！！");
		}
	}
}